<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
	<div>
		<form action="" method="post">
			<label>姓名：</label>
			<input type="text" name="name" value="<?=$data_student[1]?>" />
			<br>
			<label>学号：</label>
			<input type="text" name="num" value="<?=$data_student[2]?>" />
			<br>
			<label>学科：</label>
			<input type="text" name="subject" value="<?=$data_student[3]?>" />
			<br>
			<label>专业：</label>
			<select name="major">
			<?php
			foreach($data_major as $key => $value){
			?>
				<option id="opt<?=$value[0]?>" value="<?=$value[0]?>"><?=$value[1]?></option>
			<?php
			}
			?>
			</select>
			<br>
			<input type="submit" name="sub" value="更改" />
		</form>
	</div>
<script>
	var option = document.getElementById('opt<?=$data_student[4]?>');
	option.selected = "selected";
</script>
</body>
</html>